package com.graduate.game.user.service;

import com.graduate.game.user.mapper.UserMapper;
import com.graduate.game.user.pojo.User;
import com.graduate.game.user.pojo.userdata;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public List<User> lookAll() {
        return userMapper.queryUserList();
    }
    @Override
    public String checkPassword(String username) {
        return userMapper.checkUser(username);
    }

    @Override
    public List<String> lookUsername() {
        return userMapper.lookUsername();
    }

    @Override
    public boolean zhuCe(User user) {
        int x = userMapper.insertUser(user);
        if(x>0){
            return true;
        }else {
            return false;
        }

    }

    @Override
    public boolean zhuCe_data(userdata userdata) {
        int x = userMapper.insertUserdata(userdata);
        if(x>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public String getVersion(String username) {
        return userMapper.checkVersion(username);
    }

    @Override
    public User getOneUser(String username) {
        return userMapper.getOneUsername(username);
    }

    @Override
    public boolean updateUser(User user) {
        int x = userMapper.updateUser(user);
        if(x>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public List<User> serchUsers(String username) {
        return userMapper.serchUser(username);
    }
}
